/*
 * @: 
 * @Version: 1.0
 * @Autor: ziwei
 * @Date: 2022-03-10 14:11:22
 * @LastEditors: ziwei
 * @LastEditTime: 2022-03-10 16:50:31
 */
const express = require('express')
const logger = require('morgan')
const compression = require('compression')
const delayConfig = require('./delayConfig');
const app = express();
app.use(logger('dev'))
app.use((req,res,next)=>{
  let url = req.url
  const delay = delayConfig[url]
  if(delay){
    setTimeout(next,delay)
  }else{
    next()
  }
})
//启用Gzip压缩
app.use(compression())
app.use(express.static('public'))
app.listen(80,()=>console.log('服务器已经在80端口上启动了...'))